package com.example.testluckyroulette

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.example.testluckyroulette.bean.LuckyPersonBean
import kotlinx.android.synthetic.main.activity_main.*
import kotlin.collections.ArrayList

class MainActivity : AppCompatActivity() {
    var i = 0
    val arrayList = ArrayList<LuckyPersonBean>()


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        initTest2()
        two.setOnClickListener {
            lucky.clear()
            lucky.setData(arrayList.subList(0,2),2)
        }
        three.setOnClickListener {
            lucky.clear()
            lucky.setData(arrayList.subList(0,3),3)
        }
        four.setOnClickListener {
            lucky.clear()
            lucky.setData(arrayList.subList(0,4),4)
        }
        five.setOnClickListener {
            lucky.clear()
            lucky.setData(arrayList.subList(0,5),5)
        }
        six.setOnClickListener {
            lucky.clear()
            lucky.setData(arrayList.subList(0,6),6)
        }
        seven.setOnClickListener {
            lucky.clear()
            lucky.setData(arrayList.subList(0,7),7)
        }
        eight.setOnClickListener {
            lucky.clear()
            lucky.setData(arrayList.subList(0,8),8)
        }
    }



    fun initTest2() {

        var l = LuckyPersonBean().apply {
            id = 1
            avatar = "https://img.q17z.com/picture_1594275736284.jpg?imageslim"
            name = "lin1"
            color = R.color.colorAccent1
        }
        var l2 = LuckyPersonBean().apply {
            id = 2
            avatar = "https://img.q17z.com/FvCHQaXeyCf-6go1vPsJWj8KnbeC?imageslim"
            name = "lin2"
            color = R.color.colorAccent2
        }
        var l3 = LuckyPersonBean().apply {
            id = 3
            avatar = "https://img.q17z.com/FvCHQaXeyCf-6go1vPsJWj8KnbeC?imageslim"
            name = "lin3"
            color = R.color.colorPrimaryDark
        }
        var l4 = LuckyPersonBean().apply {
            id = 4
            avatar = "https://img.q17z.com/FvCHQaXeyCf-6go1v"
            name = "lin4"
            color = R.color.colorAccent5
        }
        var l5 = LuckyPersonBean().apply {
            id = 5
            avatar = "https://img.q17z.com/FvCHQanbeC?imageslim"
            name = "lin5"
            color = R.color.colorAccent4
        }
        var l6 = LuckyPersonBean().apply {
            id = 6
            avatar = "https://img.q17z.com/FvCHQanbeC?imageslim"
            name = "lin6"
            color = R.color.colorAccent3
        }
        var l7 = LuckyPersonBean().apply {
            id = 7
            avatar = "https://img.q17z.com/FvCHQanbeC?imageslim"
            name = "lin7"
            color = R.color.colorAccent
        }
        var l8 = LuckyPersonBean().apply {
            id = 8
            avatar = "https://img.q17z.com/FvCHQanbeC?imageslim"
            name = "lin8"
            color = R.color.colorPrimary
        }
        arrayList.add(l)
        arrayList.add(l2)
        arrayList.add(l3)
        arrayList.add(l4)
        arrayList.add(l5)
        arrayList.add(l6)
        arrayList.add(l7)
        arrayList.add(l8)
    }

}